const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { type } = require('os')
module.exports={
  entry:'./src/main.js',
  output:{
    path:path.join(__dirname,'./dist'),
    filename: 'bundle.js'
  },

  plugins:[
    new HtmlWebpackPlugin({
     template:'./public/index.html'
    })
  ],
  module:{
    rules:[
      {
        test:/\.css$/i,
        use:['style-loader','css-loader']
      },
      {
        test:/\.less$/i,
        use:['style-loader','css-loader','less-loader']
      },
      {
        test:/\.(png|jpg|gif|jepg|weeb)/i,
        type:"asset"
      },
      {
        test:/\.(eot|svg|ttf|woff|woff2)/i,
        type:'asset/resource',
        generator:{
           filename:'fonts/[name]-[hash:6][ext]'
        }
      },
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      }
    ]
  },
  devServer:{

  },
  mode:'development'
}